package com.itgaoshu.service.impl;

import com.itgaoshu.bean.SysRole;
import com.itgaoshu.mapper.SysRoleMapper;
import com.itgaoshu.service.SysRoleService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author: xiyue
 * Date: 2021/3/22
 * Time: 10:54
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
@Transactional
public class SysRoleServiceImpl implements SysRoleService {
    @Resource
    private SysRoleMapper roleMapper;

    //查询所有角色
    @Override
    public List<SysRole> selectAllRoles(SysRole role) {
        return roleMapper.selectAllRoles(role);
    }

    //修改角色
    @Override
    public int updateRole(SysRole role) {
        return roleMapper.updateByPrimaryKey(role);
    }

    //添加角色
    @Override
    public int addRole(SysRole role) {
        return roleMapper.insert(role);
    }
    //删除角色
    @Override
    public int deleteRole(Integer roleid) {
        return roleMapper.deleteByPrimaryKey(roleid);
    }
}
